Rendering content to a composition target
Use a Composition Target Render Pass to render content to a composition target.
Composition Target Render Pass automatically creates a texture from the content that it renders. You can use a Blit Render Pass to draw this texture to the screen or to another composition target using a specific material. To render content to a Render Target Texture, you can use the Render to Texture Pass. See Rendering to texture.
To render content to a composition target:
-
In the Library press Alt and right-click Rendering, and select Compose and Blit Pass.
Compose and Blit Pass template contains the render pass structure that enables you to blit to the screen Composition Target Render Pass render passes or textures using a specific material. The template contains these render passes:- Composition Target Render Pass renders itself and its child render passes to a composition target.
- Clear Render Pass clears some or all of the buffers of the current render context. By default the Clear Render Pass in the Compose and Blit Pass template clears the color buffer with transparent black color and the depth buffer with value 1.
For example, to clear the color buffer with a different color, set the Clear Color property to the color that you want to use as the background color of the content that Kanzi renders to the Composition Target Render Pass. - Draw Objects Render Pass allows you to set a Camera node to render a specific object source and to control frustum culling. By default the Draw Objects Render Pass uses the default Camera node to render all nodes in a Scene node.
- Blit Render Pass blits one or more render passes or textures on the screen using a specific material. By default this Blit Render Pass draws on the screen the content rendered by the Composition Target Render Pass.
- In the Project select the Scene node whose content you want to render to a composition target and in the Properties set the Render Pass property to the Compose and Blit Pass.
Kanzi renders the content of that Scene node to a composition target and uses the Blit Render Pass to draw the content on the screen.
- (Optional) If you do not set the Composition Target property, you can set these properties in the Composition Target Render Pass:
- Resolution Multiplier and Resolution Divisor to set the resolution of the default composition target.
Kanzi Studio multiplies the resolution of the composition target by the value of the Resolution Multiplier property and divides it by the value of the Resolution Divisor property.
For example, to multiply the resolution of the composition target by four set Resolution Multiplier to 4. To reduce the resolution of the composition target to a quarter of the original, set Resolution Divisor to 4.
- Pixel Format to set the pixel format of the composition target.
- Depth Texture Format to set the format of the depth composition target.
- Addressing Mode to set how Kanzi handles the texture coordinates of the composition target textures outside the [0, 0] - [1, 1] rectangle:
- Clamp to confine the texture to these coordinates and to repeat the edge texels of the texture outside of the coordinates. This is the default value.
- Repeat to make the texture repeat outside of these coordinates.
- Filter Mode to set how Kanzi accesses the texture samples of the composition target:
- Nearest to take the color from the nearest sample.
- Linear to interpolate the color from the neighboring samples. This is the default value.
- Mipmap Mode to create mipmaps for the composition target. See Creating mipmaps for a composition target.
- Multisample Level to set the number of anti-aliasing samples you want to use. See Using multisampling.
See also
Rendering
Using Kanzi Studio render pass templates
Rendering multiple render passes or textures
Creating mipmaps for a composition target
Using multisampling
Tutorial: Create a Gaussian blur effect
Tutorial: Create a bloom effect
Open topic with navigation